var deleteDuplicates = function(head) {
    if(!(head))return head
    if(!(head.next))return head
    let dummyHead = new ListNode(0);
    dummyHead.next = head;
    let result = dummyHead
    while(dummyHead.next.next){
        if(dummyHead.next.val==dummyHead.next.next.val){
            dummyHead.next = dummyHead.next.next
            if(!(dummyHead.next.next)){
                dummyHead.next=dummyHead.next.next
                return result.next
            }
            if(dummyHead.next.val!==dummyHead.next.next.val){
                dummyHead.next=dummyHead.next.next
            }
        }else{
            dummyHead = dummyHead.next
        }
    }
    return result.next
}